package com.example.bookstore.validate

import com.example.bookstore.entity.UserEntity
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import javax.validation.constraints.NotBlank

/**
 * Created by IntelliJ IDEA.
 * User: lvshe
 * Date: 2019/8/13
 * Time: 18:53
 */
@ApiModel("用户注册", description = "用户注册信息Json格式")
class UserRegisterValidate {

    @NotBlank
    @ApiModelProperty("昵称")
    lateinit var nickname: String

    @NotBlank
    @ApiModelProperty("邮箱")
    lateinit var email: String

    @NotBlank
    @ApiModelProperty("密码")
    lateinit var password: String

    fun toUserEntity(): UserEntity {
        return UserEntity(nickname, email, password)
    }

}